package com.hema.auction.adapter;

import android.support.v7.widget.RecyclerView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.hema.auction.R;
import com.hema.auction.bean.GoodsInfo;
import com.hema.auction.utils.Utils;
import com.hema.auction.widget.view.ClassGoodsView;
import com.yqritc.recyclerviewflexibledivider.HorizontalDividerItemDecoration;

import java.util.List;

/**
 * author by john
 */

public class GoodsAdapter extends BaseQuickAdapter<GoodsInfo, BaseViewHolder> implements HorizontalDividerItemDecoration.MarginProvider {
    public GoodsAdapter(List<GoodsInfo> data) {
        super(R.layout.layout_goods_item, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, GoodsInfo item) {
        helper.addOnClickListener(R.id.tv_collection);
        ClassGoodsView view = helper.getView(R.id.class_goods_view);
        view.setInfo(item);

    }

    @Override
    public int dividerLeftMargin(int position, RecyclerView parent) {
        return Utils.dp2px(mContext, 108);
    }

    @Override
    public int dividerRightMargin(int position, RecyclerView parent) {
        return 0;
    }
}
